/*    */ package system.staros.ablock2;
/*    */ 
/*    */ import java.io.File;
/*    */ import java.io.FileOutputStream;
/*    */ import java.io.IOException;
/*    */ import java.io.InputStream;
/*    */ import java.io.PrintStream;
/*    */ import java.net.MalformedURLException;
/*    */ import java.net.URL;
/*    */ import system.staros.ablock1.SysUtils;
/*    */ 
/*    */ public class Updater
/*    */ {
/*    */   public static void download(String paramString1, String paramString2)
/*    */   {
/*    */     try
/*    */     {
/* 16 */       URL localURL = new URL(paramString1);
/* 17 */       long l1 = System.currentTimeMillis();
/*    */ 
/* 19 */       System.out.println("Connecting to update server...");
/*    */ 
/* 22 */       localURL.openConnection();
/* 23 */       InputStream localInputStream = localURL.openStream();
/*    */ 
/* 29 */       File localFile = new File("system/data/staros/update/cache/" + paramString2);
/* 30 */       localFile.createNewFile();
/* 31 */       FileOutputStream localFileOutputStream = new FileOutputStream("system/data/staros/update/cache/" + paramString2);
/* 32 */       byte[] arrayOfByte = new byte[153600];
/* 33 */       int i = 0;
/* 34 */       int j = 0;
/*    */ 
/* 38 */       while ((j = localInputStream.read(arrayOfByte)) > 0)
/*    */       {
/* 40 */         localFileOutputStream.write(arrayOfByte, 0, j);
/* 41 */         arrayOfByte = new byte[153600];
/* 42 */         i += j;
/*    */       }
/*    */ 
/* 45 */       long l2 = System.currentTimeMillis();
/*    */ 
/* 47 */       localFileOutputStream.close();
/* 48 */       localInputStream.close();
/*    */     }
/*    */     catch (MalformedURLException localMalformedURLException)
/*    */     {
/* 52 */       localMalformedURLException.printStackTrace();
/*    */     }
/*    */     catch (IOException localIOException)
/*    */     {
/* 56 */       localIOException.printStackTrace();
/*    */     }
/*    */   }
/*    */ 
/*    */   public static void checkUpdates()
/*    */   {
/* 62 */     download("http://staros.ucoz.org/update/latest.xml", "latest.xml");
/* 63 */     XMLReader.parseXML();
/* 64 */     if (!XMLReader.verSsS.equalsIgnoreCase(SysUtils.getVersion()))
/* 65 */       System.out.println("New version of StarOS aviable. Type ucu -u to update");
/*    */   }
/*    */ 
/*    */   public static void downloadUpdate() {
/* 69 */     download("http://staros.ucoz.org/releases/latest.pkg", "latest.pkg");
/* 70 */     System.out.println("Done downloading.\n Please stop StarOS and run again.");
			
/*    */   }
/*    */ }

/* Location:           D:\Марк\!IMPORTANT\staros\archive\version-2.260.zip
 * Qualified Name:     system.staros.ablock2.Updater
 * JD-Core Version:    0.6.1
 */